﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CNKI.TPI.Web.Base.Log
{
    public class LogMessage
    {
        public LogMessage(string UserID, string UserName, int Type, long Elapsed, string OperateClass, string OperateFunc, string InParameter, string OutParameter, string Message, string Ip)
        {
            this.UserID = UserID;
            this.UserName = UserName;
            this.OperateFunc = OperateFunc;
            this.OperateClass = OperateClass;
            this.InParameter = InParameter;
            this.OutParameter = OutParameter;
            this.Message = Message;
            this.Type = Type;
            this.Elapsed = Elapsed;
            this.Ip = Ip;
        }

        public LogMessage(string UserID, string UserName, string Ip, string DBId, string DBCode, string SysId, int Source, string title)
        {
            this.UserID = UserID;
            this.UserName = UserName;
            this.DBId = DBId;
            this.DBCode = DBCode;
            this.SysId = SysId;
            this.Source = Source;
            this.Ip = Ip;
            this.Title = title;
        }

        public LogMessage(string UserID, string UserName, string Ip, string DBId, string DBCode, string SysId, string fileId, int Source, string title)
        {
            this.UserID = UserID;
            this.UserName = UserName;
            this.DBId = DBId;
            this.DBCode = DBCode;
            this.SysId = SysId;
            this.Source = Source;
            this.Ip = Ip;
            this.FileId = fileId;
            this.Title = title;
        }

        public LogMessage(string UserName, string Ip, string Status)
        {
            this.UserName = UserName;
            this.Ip = Ip;
            this.Status = Status;
        }

        public LogMessage(string UserID, string UserName, string Ip, string DBId, string DBCode, string Query, string Order, string SearchType, string ClassCode, string TopicCLS, string TopicNode)
        {
            this.UserID = UserID;
            this.UserName = UserName;
            this.Ip = Ip;
            this.DBId = DBId;
            this.DBCode = DBCode;
            this.Query = Query;
            this.Order = Order;
            this.SearchType = SearchType;
            this.ClassCode = ClassCode;
            this.TopicCLS = TopicCLS;
            this.TopicNode = TopicNode;
        }

        public string UserID { set; get; }
        public string UserName { set; get; }
        public string OperateClass { set; get; }
        public string OperateFunc { set; get; }
        public string InParameter { set; get; }
        public string OutParameter { set; get; }
        public string Message {set; get;}
        public int Type { set; get; }
        public long Elapsed { set; get; }
        public string Ip { set; get; }
        public string DBId { set; get; }
        public string DBCode { set; get; }
        public int Source { set; get; }
        public string SysId { set; get; }
        public string FileId { set; get; }
        public string Status { set; get; }
        public string Title { set; get; }
        public string Query { set; get; }
        public string Order { set; get; }
        public string SearchType { set; get; }
        public string ClassCode { set; get; }
        public string TopicCLS { set; get; }
        public string TopicNode { set; get; }

        public override string ToString()
        {
            string result = Message;
            if (string.IsNullOrEmpty(result))
            {
                result = OperateClass + "." + OperateFunc;
            }
            return result;
        }
    }
}
